import { Modal, Form } from 'antd';
import React from 'react';
import moment from 'moment';

const C = (props: any) => {
  const { show, showLoading, hide, rowData } = props;
  let imgTem: any;
  if (rowData && rowData.images) {
    imgTem = (
      <span>
        {rowData.images.split(',').map((item: any) => (
          <img style={{ maxWidth: '100%' }} key={item} alt="描述图片" src={item} />
        ))}
      </span>
    );
  }
  return (
    <>
      <Modal
        title="查看"
        width="600px"
        okText="确定"
        visible={show}
        onCancel={() => {
          hide();
        }}
        onOk={() => hide()}
        confirmLoading={showLoading}
      >
        <Form labelCol={{ span: 4 }} wrapperCol={{ span: 14 }}>
          <Form.Item label="账户：">{rowData ? rowData.userName : ''}</Form.Item>
          <Form.Item label="接收时间：">
            {rowData ? moment(rowData.receiptTime).format('YY-MM-DD HH:mm:ss') : ''}
          </Form.Item>
          <Form.Item label="类别：">{rowData ? rowData.typeName : ''}</Form.Item>
          <Form.Item label="标题：">{rowData ? rowData.title : ''}</Form.Item>
          <Form.Item label="描述：">
            {rowData ? rowData.content : ''}
            {imgTem}
          </Form.Item>
        </Form>
      </Modal>
    </>
  );
};
const D = Form.create()(C);
export default D;
